#ifndef __UTILS_H__
#define __UTILS_H__

#include <stdio.h>

static void handle_host_null( void* ptr, const char *file, int line )
{
		if ( ptr == NULL ) {
			printf( "Warning: the pointer is NULL in %s at line %d\n", __FILE__, __LINE__ );
		}
}

#define HANDLE_HOST_NULL( ptr ) ( handle_host_null( ptr, __FILE__, __LINE__ ) )

static void host_free( void* ptr, const char *file, int line )
{
	if ( ptr == NULL ) {
		printf( "Warning: a NULL memory free in %s at line %d\n", __FILE__, __LINE__ );
	}
	else
	{ free ( ptr ); }
}

#define HANDLE_HOST_FREE( ptr ) ( host_free( ptr, __FILE__, __LINE__ ) )

#endif /* __UTILS_H__ */
